package com.example.project.controller;

import com.example.project.entity.Department;
import com.example.project.service.IDepartmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 作者：金照富
 * 2023年11月4日
 */
@RestController
@Api
public class Departmentontroller {
    @Autowired
    private IDepartmentService departmentService;

    @ApiOperation(value = "添加部门")
    @RequestMapping("/inDepart")
    public int insertDepartment(Department department){
        return departmentService.insertDepartment(department);
    }

    @ApiOperation(value = "删除部门")
    @RequestMapping("/deleteDepartment")
    public int deleteDepartment(Department department){
        return departmentService.deleteDepartment(department);
    }

    @ApiOperation(value = "修改部门")
    @RequestMapping("/updateDepartment")
    public int updateDepartment(Department department){
        return departmentService.updateDepartment(department);
    }

    @ApiOperation(value = "查询所有部门信息")
    @RequestMapping("/getAllDepartment")
    public List<Department> getAllDepartment(Department department){
        return departmentService.getAllDepartment(department);
    }

    @ApiOperation(value = "查询部门信息")
    @RequestMapping("/getDepartment")
    public Department getDepartment(Department department){
        return departmentService.getDepartment(department);
    }
}